<?php

declare(strict_types=1);

/**
 * @Author:     Frank
 * @contact     frank_hhm@163.com
 * @Date:       2022-11-09 16:16:44
 * @Last Modified time: 2022-11-23 13:58:57
 */
namespace app\common\dao\system;

use frank\base\BaseDao;
use app\common\model\system\RoleModel;

/**
 * Class RoleDao
 * @package app\common\dao\system
 */
class RoleDao extends BaseDao
{
    /**
     * 设置模型名
     */
    protected function setModel(): string
    {
        return RoleModel::class;
    }

    /**
     * 获取权限
     */
    public function getRoule(array $where = [], ?string $field = null, ?string $key = null)
    {
        return $this->search($where)->column($field ?: 'role_name', $key ?: 'id');
    }

    /**
     * 获取身份列表
     */
    public function getRouleList(array $where, int $page, int $limit)
    {
        return $this->search($where)->page($page, $limit)->select()->toArray();
    }
}
